/** 
 * 添加cookie
 * @param name cookie名字
 * @param value 值
**/
function setCookie(name,value)
{
 
    //此 cookie 将被保存 1 天
    var Days = 1; 
 
    var exp = new Date();
 
    exp.setTime(exp.getTime() + Days*24*60*60*1000);
    document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
}

/**
 * 获取cookie
 * @param name cookie名称
 * @returns cookie的值
 */
function getCookie(name) {
    var arr = document.cookie.match(new RegExp("(^| )" + name + "=([^;]*)(;|$)"));
 
    if (arr != null) return unescape(arr[2]);
 
    return null;
}

/**
 * 删除cookie
 * @param name cookie名字
 */
function delCookie(name) {
    var exp = new Date();
    exp.setTime(exp.getTime() - 1);
    var cval = getCookie(name);
    if (cval != null) {
        // 这里删除操作其实是将expires过期时间设置为当前时间，使cookie立即过期
        document.cookie = name + "=" + cval + ";expires=" + exp.toGMTString();
    }
}

/** 
 * 
 * @param token 值
**/
function setToken(token){
	window.localStorage.setItem("shangyun_plart_token",token);
}

/** 
 * 
 * @param 获取token值
**/
function getToken(){
  var token = window.localStorage.getItem("shangyun_plart_token");
  if(token != null){
	  return token
  }
  return null;
}

/** 
 * 
 * @param 移除token值
**/
function removeToken(){
 window.localStorage.removeItem('shangyun_plart_token')
}


function setUUId(uuid){
	window.localStorage.setItem("shangyun_plart_uuid",uuid);
}

function getUUId(){
  var token = window.localStorage.getItem("shangyun_plart_uuid");
  if(token != null){
	  return token
  }
  return null;
}

function removeUUId(){
 window.localStorage.removeItem('shangyun_plart_uuid')
}


function setGrade(grade){
	window.localStorage.setItem("shangyun_plart_grade",grade);
}

function getGrade(){
   var grade =	window.localStorage.getItem("shangyun_plart_grade");
   if(grade != null){
   	  return grade
   }
   return null;

}

function removeGrade(){
	window.localStorage.removeItem("shangyun_plart_grade");
}


function setShopId(shopId){
	window.localStorage.setItem("shangyun_plart_shopSSId",shopId);
}

function getShopId(){
	 var shopId = window.localStorage.getItem("shangyun_plart_shopSSId");
	 if(shopId != null){
	 	  return shopId
	 }
	 return null;
}

function removeShopId(){
	window.localStorage.removeItem("shangyun_plart_shopSSId");
}
